var MM = MARS = {
	/**
	 * 创建窗口
	 */
	addWindow : function(opts) {
		var options = $.extend({
			width: 600, height: 600, modal: true, resizable: true, 
			minimizable: false, maximizable: false, collapsible: false, loadingMessage: '页面加载中', 
		    onClose : function(){
		    	$(this).window("destroy");
		    },
		    onLoad: function() {
		    	//$(".form-panel").panel('resize',{height: $(this).window("options").height - 73}) ;
		    	$(".form-panel").panel({"footer": '#footer'});
			},
			onResize: function(width, height) {
				//$(".form-panel").panel('resize',{height: height - 73}) ;
			}
		}, opts);
		
		return $('<div>').window(options);
	},
	/**
	 * 关闭当前窗口
	 */
	closeCurrentWindow: function() {
		$(".panel-tool-close").click();
	},
	/**
	 * 获取列表选中ids
	 */
	getSelectionsIds: function(select, idField) {
		
		var list = $(select).datagrid('getSelections');
		var ids = [];
		$.each(list, function() {
			if(undefined != idField) {
				ids.push($(this)[0][idField]) ;
			} else {
				ids.push($(this)[0].id) ;
			}
		});
		return ids.join(",");
	},
	/**
	 * 序列号表单
	 * select 元素
	 * flag true：为空元素的不选择，false:选择所有元素
	 */
	getData: function(target, flag) {
		return $(target).serializeObject() ;
		/*var o = {}, flag = (flag==undefined?true:false);
		$.each($(select).serializeArray(), function(index) {
			if(undefined != flag && flag == true) {
				if (this['value'] != undefined && this['value'].length > 0) {
					if (o[this['name']]) {
						o[this['name']] = o[this['name']] + "," + this['value'];
					} else {
						o[this['name']] = this['value'];
					}
				}
			} else {
				if (o[this['name']]) {
					o[this['name']] = o[this['name']] + "," + this['value'];
				} else {
					o[this['name']] = this['value'];
				}
			}
		});
		return o;*/
	}
};

//提示框设置
alertify.set({ delay : 3000 });
alertify.warning = alertify.extend('warning');
alertify.info = alertify.extend('info');